#include "CStateManagement.h"
namespace GameTuTor
{
	CStateManagement* CStateManagement::s_pInstance = 0;
	void CStateManagement::Update(bool isPause)
	{
		if(m_pCurrentState != m_pNextState)
		{
			if(m_pCurrentState)
			{
				m_pCurrentState->Exit();
				delete m_pCurrentState;
			}
			if(m_pNextState)
			{
				m_pNextState->Init();
			}
			m_pCurrentState = m_pNextState;
		}
		if(m_pCurrentState)
		{
			if(!isPause)
			{
				m_pCurrentState->Update();
			}
			m_pCurrentState->Render();
		}
	}
}